package cn.wolfcode;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.netflix.hystrix.dashboard.EnableHystrixDashboard;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

@SpringBootApplication
@EnableFeignClients  //自动扫描 feign 的客户端
@EnableCircuitBreaker	//开启熔断
@EnableHystrixDashboard	 	//断路器监控仪表盘

public class OrderServerApplication {

	//RestTemplate: SpringMVC 中提供的类，可以发送HTTP请求
	@Bean
	@LoadBalanced //负载均衡
	public RestTemplate template(){
		return new RestTemplate();
	}

	public static void main(String[] args) {
		SpringApplication.run(OrderServerApplication.class, args);
	}

}
